using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace tutors_clus.Models.Mapping
{
    public class student_courseMap : EntityTypeConfiguration<student_course>
    {
        public student_courseMap()
        {
            // Primary Key
            this.HasKey(t => t.id_stu_cou);

            // Properties
            // Table & Column Mappings
            this.ToTable("student_course");
            this.Property(t => t.id_stu_cou).HasColumnName("id_stu_cou");
            this.Property(t => t.id_cou).HasColumnName("id_cou");
            this.Property(t => t.id_stu).HasColumnName("id_stu");
            this.Property(t => t.registered_stu).HasColumnName("registered_stu");

            // Relationships
            this.HasRequired(t => t.course)
                .WithMany(t => t.student_course)
                .HasForeignKey(d => d.id_cou);
            this.HasRequired(t => t.student)
                .WithMany(t => t.student_course)
                .HasForeignKey(d => d.id_stu);

        }
    }
}
